package sk.tramtatiri.data.dataobjects;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
public class Recipe extends DomainObject{

	private static final long serialVersionUID = -2765524452764281566L;

	@Id
	@GeneratedValue
	private Long id;
	
	@OneToMany(mappedBy="recipe",fetch=FetchType.EAGER)
	@Cascade({CascadeType.REMOVE})
	private Collection<UserRecipe> users;
	
	private String name;
	private String description;
	private String[] ingredients;
	private int rating;
	private int calories;
	private int proteins;
	private int fats;
	private int saccharides;
	private int difficulty;
	private long creatorID;
	private int portion;
	private int[] weights;
	//udava ci recept bol vytvoreny so vsetkymi hodnotami
	//(napr. hodnotami potravin, ktore sa nenasli v databaze)
	private boolean isAllValues;
	
	public Recipe() {
		users = new ArrayList<UserRecipe>();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String[] getIngredients() {
		return ingredients;
	}

	public void setIngredients(String[] ingredients) {
		this.ingredients = ingredients;
	}

	public int getRating() {
		return rating;
	}

	public void setRating(int rating) {
		this.rating = rating;
	}

	public int getCalories() {
		return calories;
	}

	public void setCalories(int calories) {
		this.calories = calories;
	}

	public int getProteins() {
		return proteins;
	}

	public void setProteins(int proteins) {
		this.proteins = proteins;
	}

	public int getFats() {
		return fats;
	}

	public void setFats(int fats) {
		this.fats = fats;
	}

	public int getSaccharides() {
		return saccharides;
	}

	public void setSaccharides(int saccharides) {
		this.saccharides = saccharides;
	}

	public int getDifficulty() {
		return difficulty;
	}

	public void setDifficulty(int difficulty) {
		this.difficulty = difficulty;
	}

	public Long getId() {
		return id;
	}

	public long getCreatorID() {
		return creatorID;
	}

	public void setCreatorID(long creatorID) {
		this.creatorID = creatorID;
	}

	public int getPortion() {
		return portion;
	}

	public void setPortion(int portion) {
		this.portion = portion;
	}

	public boolean isAllValues() {
		return isAllValues;
	}

	public void setAllValues(boolean isAllValues) {
		this.isAllValues = isAllValues;
	}

	public int[] getWeights() {
		return weights;
	}

	public void setWeights(int[] weights) {
		this.weights = weights;
	}

	public Collection<UserRecipe> getUsers() {
		return users;
	}

	public void setUsers(Collection<UserRecipe> users) {
		this.users = users;
	}
	
}
